package cn.org.zych.threadlocal;

/**
 * @ClassName:   Singleton
 * @Description:
 * @Auther: zhouych
 * @Date: 2019/3/15 15:26
 */
public class Singleton {

    private static final ThreadLocal<Singleton> threadLocal =
            new ThreadLocal<Singleton>(){
                @Override
                protected Singleton initialValue() {
                    return new Singleton();
                }
            };

    private Singleton(){

    }

    public static Singleton getInstance(){
        return threadLocal.get();
    }
}
